#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;
using ll = long long;
using db = double;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 2010;

int n,x,a[N],b[N][N];
ll ans[N];

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    n = in,x = in; for(int i = 0;i < n;i++) a[i] = in;
    for(int i = 0;i < n;i++) {
	b[i][0] = a[i];
	for(int j = 1;j < n;j++) b[i][j] = min(b[i][j - 1],a[(i - j + n) % n]);
    }
    ll res = 1e18;
    for(int i = 0;i < n;i++) {
	for(int j = 0;j < n;j++) ans[i] += b[j][i];
	ans[i] += 1ll * x * i; res = min(res,ans[i]);
    } printf("%lld\n",res); return 0;
}
